﻿#include "dialog.h"
#include "ui_dialog.h"
#include <QDebug>

Dialog::Dialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::Dialog)
{
    ui->setupUi(this);
    dialog = new MsgDialog(this);
}

Dialog::~Dialog()
{
    delete ui;
}


void Dialog::on_pushButton_clicked()
{
    qDebug() << "msg";
    dialog->setTitle("静夜思");
    dialog->setContent("床前明月光，疑是地上霜。\n举头望明月，低头思故乡。");
    dialog->setBackgroundColor(QColor("#31bdec"));
    dialog->setBackgroundOpacity(0.5f);
    dialog->setFontColor(QColor("#ffffff"));
    dialog->setFontSize(10);
    dialog->setCornerRadius(5);
    dialog->setBorderTransparent(true);
    dialog->setAutoCloseTimeout(3000); // 3 秒后自动关闭
    dialog->setIcon(QIcon(":/icons/success.png")); // 设置自定义图标
    dialog->setIconPosition(MsgDialog::IconTop); // 设置图标显示在顶部

    dialog->resize(250, 150);
    dialog->exec();
}
